package com.gamehall.core;

import java.util.List;

import com.gamehall.cmd.UserCommand.GamePlayer;
import com.gamehall.cmd.UserCommand.TianDaKengCardCmd;

public class BaChaPlayer extends TablePlayer{

	private int seatNo;
	
	private BaChaGroupCard groupCard;
	
	private NetPlayer player;
	
	public BaChaPlayer(IPlayer player, int seatNo) {
		super(player, seatNo);
	}

	public int getSeatNo() {
		return seatNo;
	}

	public void setSeatNo(int seatNo) {
		this.seatNo = seatNo;
	}

	public BaChaGroupCard getGroupCard() {
		return groupCard;
	}

	public void setGroupCard(BaChaGroupCard groupCard) {
		this.groupCard = groupCard;
	}
	
	public GamePlayer toCommand(){
		GamePlayer.Builder gp = GamePlayer.newBuilder();
		gp.setGold(player.getGold());
		gp.setHeadUrl(player.getHeadUrl());
		gp.setNickname(player.getNickName());
		gp.setUId(player.getUserId());
		gp.setSeatNo(seatNo);
		gp.setIsReady(isReady);
		List<TianDaKengCardCmd> list = BaseCard.toCommand(groupCard.toListBaseCard());
		gp.addAllCards(list);
		gp.setIsBanker(isBanker());
		gp.setBet(getBet());
		return gp.build();
	}
	
	public void resetChess() {
		setGroupCard(null);
	}
	
}
